<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">

			function disptime() {
				var today = new Date();
				var year=today.getFullYear();
				var month=today.getMonth();
				var day=today.getDate(); 
				var hh = today.getHours();
				var mm = today.getMinutes();
				var ss = today.getSeconds();
				var week=today.getDay();
				if(hh<=24){
					document.getElementById("mytime").innerHTML = "现在是:"  + year + "-"+ month + "-"  + day + " 上午"  + hh + ":" + mm + ": " + ss+ " 今天是星期"  + week;
				}else{
					document.getElementById("mytime").innerHTML = "现在是:"  + year + "-"+ month + "-"  + day + " 傍晚"  + (hh-12) + ":" + mm + ": " + ss+ " 今天是星期"  + week;
				}
				
			}
			function starttime(){
				var mytime=setInterval("disptime()", 1000);
			}	
		</script>
	</head>
	<body>
		<input type="button" value="现在的时间是:" onclick="starttime()" />
		<div id="mytime">
			
		</div>
	</body>
</html>